from config import Config

class SubscriptionManager:
    def __init__(self):
        self.config = Config()
        self.subscriptions = self.config.load_subscriptions()

    def add_subscription(self, repo_url):
        if repo_url not in self.subscriptions:
            self.subscriptions.append(repo_url)
            self.config.save_subscriptions(self.subscriptions)
            print(f"Added subscription: {repo_url}")
        else:
            print(f"Subscription already exists: {repo_url}")

    def remove_subscription(self, repo_url):
        if repo_url in self.subscriptions:
            self.subscriptions.remove(repo_url)
            self.config.save_subscriptions(self.subscriptions)
            print(f"Removed subscription: {repo_url}")
        else:
            print(f"Subscription not found: {repo_url}")

    def list_subscriptions(self):
        return self.subscriptions
